package cn.edu.zafu.bigdata.Wym;

import java.util.HashMap;

public class Wym_StudentGradeManager {
    HashMap<String,Integer> studentGrades;//集合类（键，值）

    public Wym_StudentGradeManager(){
        studentGrades=new HashMap<>();
    }

    public void addStudent(String name, int grade){
        studentGrades.put(name,grade);
    }

    public int getGrade(String name){
        return studentGrades.getOrDefault(name,-1);
    }

    public void removeStudent(String name){
        studentGrades.remove(name);
    }

    public static void main(String[] args){
        Wym_StudentGradeManager manager=new Wym_StudentGradeManager();
        manager.addStudent("A",90);
        manager.addStudent("B",78);
        manager.addStudent("C",100);

        System.out.println("A's grade:"+manager.getGrade("A"));
        System.out.println("B's grade:"+manager.getGrade("B"));
        System.out.println("C's grade:"+manager.getGrade("C"));

        manager.removeStudent("A");
        System.out.println("A's grade:"+manager.getGrade("A"));
    }

}
